package org.ehe.finance.receipt.enums;

/**
 * 收款类型枚举
 * @author :zhangnn
 * @className :ReceiptType
 * @description: TODO
 * @date 2025-09-02 15:17:29
 */
public enum ReceiptType {
    SALES_RECEIPT(1, "销售收款"),
    ADVANCE_RECEIPT(2, "预收款"),
    OTHER_RECEIPT(3, "其他收款");

    private final Integer code;
    private final String desc;

    ReceiptType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() { return code; }
    public String getDesc() { return desc; }

    public static String getDescByCode(Integer code) {
        for (ReceiptType type : values()) {
            if (type.code.equals(code)) {
                return type.desc;
            }
        }
        return "未知";
    }
}
